import request from "@/utils/request";
import axios from "axios";
export const serverApi = new class{
    //登录接口
    login(data){
        return request({
            method:"POST",
            url:"/login",
            data:data
        })
    }
    //首页接口
    honeIndex(data){
        return request({
            method:"POST",
            url:'/index/articleSum',
            params:{
                uid:data
            }
        })
    }
    //书写台-查询文章
    selectArticle(data){
        return request({
            method:"POST",
            url:"/selectArticle",
            params:{
                uid:data
            }
        })
    }
    //书写台-保存文章(添加文章)
    addArticle(data){
        return request({
            method:"POST",
            url:"/addArticle",
            data:data
        })
    }
    //书写台-修改文章
    updateArticle(data){
        return request({
            method:"POST",
            url:"/updateArticle",
            data:data
        })
    }
    //书写台-删除文章
    deleteArticle(data){
        return request({
            method:"POST",
            url:"/deleteArticle",
            params:{
                id:data
            }
        })
    }
    //书写台-分页
    page(data){
        return request({
            method:"POST",
            url:"/page",
            params:{
                pageNum:data.pageNum,
                pageSize:data.pageSize,
                uid:data.uid
            }
        })
    }
    //书写台-图片上传
    upload(data){
        return axios({
            method:"POST",
            url:'http://localhost:8188/file/upload',
            data:data,
            // headers:{'Content-Type':'multipart/form-data'}
            headers: { 'Content-Type': 'multipart/form-data;charset=UTF-8'},
        })
    }
    //个人中心-用户信息及修改头像
    updateUser(data){
        return request({
            method:'POST',
            url:'/updateUser',
            data:data
        })
    }

    test(){
        return request({
            method:"POST",
            url:"/test"
        })
    }
}